﻿using System;
using System.Globalization;

namespace DateTimeParse
{
    public static class DateTimeUtils
    {
        public static void MyParse(string input)
        {
            string[] formats = 
            {
                "dd.MM.yy",
                "dd.MM.yyyy",
                "dd/MM/yy",
                "dd/MM/yyyy"
            };
            DateTime result;
            if (DateTime.TryParseExact(input, formats, new CultureInfo("bg-BG"), 
                System.Globalization.DateTimeStyles.None, out result))
            {
                Console.WriteLine("day={0:dd}, month={0:MM}, year={0:yyyy}", result);
            }
            else
            {
                Console.WriteLine("Invalid DateTime.");
            }
        }
    }
}
